<?php
require_once 'vendor/autoload.php';

// 初始化应用
$app = new \think\App();
$app->initialize();

use app\model\Order;

try {
    echo "测试Order模型...\n";
    
    // 测试获取订单列表
    echo "测试获取订单列表...\n";
    $result = Order::getOrderList(['page' => 1, 'limit' => 5]);
    
    echo "总订单数: " . $result['total'] . "\n";
    echo "当前页订单数: " . count($result['list']) . "\n";
    
    if (!empty($result['list'])) {
        $firstOrder = $result['list'][0];
        echo "第一个订单信息:\n";
        echo "- 订单号: " . ($firstOrder['order_no'] ?? 'N/A') . "\n";
        echo "- 店铺名称: " . ($firstOrder['shop_name'] ?? 'N/A') . "\n";
        echo "- 商品名称: " . ($firstOrder['product_name'] ?? 'N/A') . "\n";
        echo "- 订单状态: " . ($firstOrder['order_status_str'] ?? 'N/A') . "\n";
        echo "- 实付金额: " . ($firstOrder['pay_amount'] ?? 'N/A') . "\n";
    }
    
} catch (Exception $e) {
    echo "错误: " . $e->getMessage() . "\n";
    echo "堆栈跟踪: " . $e->getTraceAsString() . "\n";
} 